package cn.dkk.behavior_design.momento.white_box;

/**
 * @author dkk
 * @date 2022/7/31
 * @desc
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("----------大战前----------");
        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.display();
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(gameRole.saveState());
        gameRole.fight();
        System.out.println("----------大战后----------");
        gameRole.display();
        System.out.println("----------恢复后----------");
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());
        gameRole.display();
    }
}
